<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>直方图统计</title>

    <!--引入本地 element-ui 的样式，-->
    <link rel="stylesheet" href="/admin/plugin/element-ui/index.css">
    <script type="text/javascript" src="/admin/js-css/js/vue.min.js"></script>
    <script type="text/javascript" src="/admin/plugin/element-ui/index.js"></script>
    <script type="text/javascript" src="/admin/plugin/element-ui/httpVueLoader.js"></script>


    <!--    引入Layui组件-->
    <link rel="stylesheet" href="/admin/plugin/layui/dist/css/layui.css" tppabs="http://res.layui.com/layui/dist/css/layui.css"  media="all">
    <script src="/admin/plugin/layui/dist/layui.js" charset="utf-8"></script>

    <script type="text/javascript" src="/admin/js-css/js/jquery-1.7.2.min.js"></script>
    <script type="text/javascript" src="/admin/js-css/js/mx1.0.js?v=1.1.1"></script>

    <script src="/admin/js-css/js/eCharts/echarts.js"></script>
    <link rel="stylesheet" type="text/css" href="/admin/js-css/css/welcome.css" />


</head>
<body>

    <div id="app">
    </div>

    <div id="main4" style="width: 800px;height:500px;"></div>

    <script>


        var vm = new Vue({
           el:"#app",
           data:{
               parmsData : {},
           },
           created(){
               this.parmsData = getParams();
               this.init();

           },
            methods:{
                async init(){
                    let res = await postWebCustom(getTableId("2"),{khid:""+this.parmsData.id});
                    var chartDom = document.getElementById('main4');
                    var myChart = echarts.init(chartDom);
                    var option;

                    option = {
                        xAxis: {
                            type: 'category',
                            data: res.data.x
                        },
                        yAxis: {
                            type: 'value'
                        },
                        series: [
                            {
                                data: res.data.y,
                                type: 'bar',
                                showBackground: true,
                                backgroundStyle: {
                                    color: 'rgba(180, 180, 180, 0.2)'
                                }
                            }
                        ]
                    };

                    option && myChart.setOption(option);
                }
            }
        });
    </script>
</body>
</html>